package work.model.com.mymvvm;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import work.model.com.mymvvm.databinding.TextActivityBinding;

/**
 * Description：
 * Created by cczhr on 2018/1/30.
 * email:cczhr1@163.com
 */

public class TextActivity extends AppCompatActivity {
    private TextActivityBinding mTextActivityBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mTextActivityBinding=DataBindingUtil.setContentView(this,R.layout.text_activity);
        mTextActivityBinding.setFirstName("测试1");
        mTextActivityBinding.setLastName("测试2");
        mTextActivityBinding.btnChange.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mTextActivityBinding.setFirstName("测试2");
                mTextActivityBinding.setLastName("测试1");
            }
        });
    }
}
